home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / VISUAL_B / H441.ZIP / VXBTEST.ZIP / VXFORM1.FRM (.txt) < prev    next >
Visual Basic Form  |  1993-05-07  |  26KB  |  578 lines

  1. VXFORM1
  2. 4vxBase Sample Application: Aircraft Brokerage System
  3. Form1%
  4. Picture1
  5. DDDK0
  6. DKDK0
  7. DKDK0
  8. Label1
  9. vxBase Sample Application
  10. MS SerifgffA1
  11. FileMenu
  12. &File
  13.     OpenTypes
  14. &Types
  15. OpenCust
  16. &Customers
  17. OpenAircraft
  18.     &Aircraft
  19.     BuyBrowse
  20. &Buyers
  21. SepBar
  22. ExitCode
  23. LinkMenu
  24. &Link
  25. LinkBuyToSell
  26. &Buyer to Sellers
  27. LinkSellToBuy
  28. &Seller to Buyers
  29. PicMenu
  30. Show &Pictures
  31.     MaintMenu
  32. &Maintenance
  33.     PackFiles
  34. &Pack
  35. TestMenu
  36. &Test
  37. TestCreate
  38. &Create
  39. TestCopy
  40. Copy &Structure
  41. TestDataCopy
  42. Copy &Data
  43.     FileStruc
  44. &File Structure
  45. RecStruc
  46. &Record Structure
  47. UMenu
  48. &User Browse Menus
  49. TextForm
  50. &Text Formatting
  51. RelStart
  52. &Alias && Relations
  53.     PrintItem
  54. &Printer Stuff
  55. ExitCode_Click
  56. VXFORM1
  57. Form_Unload
  58. Cancel
  59. CanClose
  60. Form2Activew
  61. FALSE
  62. Form3Active
  63. Form4Active
  64. Form5Active
  65. Form6Active
  66. Form7ActiveL
  67. AircraftDbfo
  68. vxUseDbf=
  69. Aircraf1Ntx~
  70. vxUseNtx[
  71. Aircraf2Ntx
  72. AirbuyerDbfi
  73. Airbuy1Ntx
  74. Airbuy2Ntx
  75. vxCloseAll
  76. vxCtlGrayReset#
  77. vxDeallocate
  78. OpenTypes_Click
  79.     TypesOpenb
  80. BrowseTypes
  81. OpenCust_Click
  82. AircustDbf
  83. Aircust1Ntx
  84. Aircust2Ntx
  85. Aircust3Ntx5
  86. vxTableDeclare
  87. VX_BLUEP
  88. vxTableFieldj
  89. VX_FIELD&
  90. StatesOpen
  91. vxSelectDbfS
  92. vxSelectNtx
  93. BrowseCust
  94. OpenAircraft_Click
  95. AircraftOpenH
  96.     BrowseAirx
  97. LinkBuyToSell_Click7
  98. VX_EXPR
  99. vxClose
  100. VX_RED
  101. vxJoinU
  102. OpenCust,
  103. Enabled
  104. LinkBuyToSell
  105. LinkSellToBuy
  106.     PackFiles=
  107. vxBrowse
  108. hWndq
  109. BuyerReturn
  110. LinkSellToBuy_Click
  111. AircraftReturnr
  112. TestCreate_Click
  113. TypeFile
  114.     FileStruc
  115.     NumFieldsF
  116. NewRet
  117.     OpenTypes 
  118. TestCreate
  119. TestCopy.
  120. TestDataCopy
  121. Fld01}
  122. Fld02
  123. vxCreateDbf)
  124. TypeDbf
  125. TypeNtx
  126. vxCreateNtx
  127. vxAppendFrom
  128. PackFiles_Click
  129.     vxAreaDbfa
  130. AirTypesDbf
  131. AirTypesNtx:
  132. vxPack
  133. TestCopy_Click
  134. NtxExpr
  135.     vxNtxExprH
  136. vxCopyStrucQ
  137. TestDataCopy_Click
  138. vxCopy^
  139. StartRecL
  140. EndRecQ
  141. vxDeleteRanges
  142. vxUnlock
  143. NtxName
  144.     vxNtxName
  145. FileStruc_Click
  146. VXFORM7+
  147. Form_Paint
  148. vxFormFrame7
  149. Form_Click
  150. OpenAircraft
  151. RecStruc_Click
  152. VXFORM8
  153. UMenu_Click
  154. vxMenuDeclare:
  155. vxMenuItem
  156. VX_MENUHEAD
  157.     VX_RETURN
  158.     VX_SEPBAR
  159. vxBrowsePos
  160. TypeReturn
  161. UMenus
  162. vxCtlGraySet
  163. LinkMenu_Click
  164. TestMenu_Clickc
  165. TextForm_Click
  166. VXFORM9
  167. vxZap
  168. RelStart_Click
  169. VYFORM0
  170. BuyBrowse_Click%
  171. vxTopG
  172. vxSetAlias0
  173. ErrCode
  174. vxSetRelation
  175. VYForm0DisplayR
  176. BuyerRec
  177. CustKey
  178. BROWSE_ERROR
  179. VXFORM3
  180. BROWSE_CLOSED
  181. vxTableReset
  182. vxSeek
  183. CustReturn
  184. BROWSE_EDIT
  185. VXFORM4
  186. vxTabbeField
  187. vxTableFieldExt
  188. vxRecNum
  189. vxRecNo
  190. TrueOrFalseA
  191. vxSetMeters
  192. Form_Resize
  193. PrintItem_ClickU
  194. VYFORM1
  195. PicMenu_Click
  196. VYFORM2
  197. vxEof
  198. vxSkip
  199. BuyBrowse_Click
  200.  example of using vxSetRelationt
  201.  and vxTableFieldExt to produced
  202.  a browse table with fields from
  203.  multiple databases included on each row
  204.  open child files first-
  205. \vb\vxbtest\aircust.dbf
  206. \vb\vxbtest\aircust1.ntx
  207.  put something in record buffer-
  208. \vb\vxbtest\airtypes.dbf
  209. \vb\vxbtest\airtypes.ntx
  210.  open parent file (has many records)
  211. \vb\vxbtest\airbuyer.dbf
  212. \vb\vxbtest\airbuy1.ntx
  213.  define alias names so we can use field
  214.  qualifiers when extracting data
  215. buyer
  216. customer
  217.  define relationship to current selection
  218.  the 1st param defines the file we setting
  219.  up the relationship to (the child file)
  220.  and the second param tells vxbase how to
  221.  construct a key to be used on the current
  222.  index in use on the child filet
  223. b_code
  224. 1st relation failed
  225. b_cat
  226. 2nd relation failed
  227.  now when we issue vxTop(), the two related
  228.  file pointers will move to match the values
  229.  in the parent file key fields
  230.  define the browse table with the extended
  231.  vxTableFieldExt functionw
  232. b_code
  233. a_name
  234. b_cat
  235. Description
  236. catname
  237. b_low
  238. b_high
  239.  Execute the browse routine
  240. Buyer Records
  241. ExitCode_Click
  242.  The master form VXFORM1 is unloaded.-
  243.  The Form_Unload procedure does thed
  244.  final cleanup.d
  245. FileStruc_Click
  246.  disable items that would be affected by
  247.  closing of aircust file
  248. Form_Click
  249.  test for active forms and set
  250.  menu items accordingly. We do this here
  251.  as well as when we start up our forms
  252.  because some functions allow otherr
  253.  functions to be active and when one or
  254.  the other is closed and menu items are
  255.  re-enabled, then we mess up our menur
  256.  disabling for the ones left open.
  257. Form_Paint
  258. Form_Resize
  259. Form_Unload
  260.  This routine is activated from either the
  261.  Exit menu item on VXFORM1 or by selecting
  262.  the Close item from the system menu.c
  263.  We MUST test the vxCloseAll result in
  264.  case there are any active browse windowsg
  265.  that require closure before we cani
  266.  terminate the application
  267.  If the close operation is successful, any
  268.  open databases FOR THIS TASK are closed
  269.  (which updates the database header information)
  270.  and all attached memory objects (Tables and Joins)-
  271.  are released.
  272.  if any of our other forms are active, we-
  273.  cannot close this form and exit the app
  274. Sub forms must be closed first
  275.  redraw top level form
  276.  NOTE: we cannot use the FORM.Visible property to-
  277.  check if any forms are active because as soon as-
  278.  we reference a form, it gets loaded - and our app
  279.  will stall with No Database messages because as soon
  280.  as the form is loaded, the database attached to that
  281.  form is referencedd
  282.  test vxcloseall with some files open-
  283. \vb\vxbtest\aircraft.dbf
  284. \vb\vxbtest\aircraf1.ntx
  285. \vb\vxbtest\aircraf2.ntx
  286. \vb\vxbtest\airbuyer.dbf
  287. \vb\vxbtest\airbuy1.ntx
  288. \vb\vxbtest\airbuy2.ntx
  289.  redraw top level form
  290.  if this is master vxbase task and other
  291.  vxbase tasks are active then we can't exite
  292.  reset system disabled color
  293. LinkBuyToSell_Click
  294.  Demonstration of setting up visual relationships-
  295.  with the vxJoin command. What we have is a file of buyers
  296.  categorized by type of aircraft they are interested in.
  297.  What we are going to do is display a browse table ofi
  298.  these buyer records and link any buyer record toe
  299.  another browse table of aircraft that match the the
  300.  buyer aircraft type field.r
  301.  Conversely, the LinkSellToBuy proc does the opposite. It
  302.  links the aircraft with all prospective buyers.
  303.  open file that will control the join-
  304. \vb\vxbtest\airbuyer.dbf
  305. \vb\vxbtest\airbuy2.ntx
  306.  this index is on aircraft type
  307.  define table to show data we are interested in-
  308. b_cat
  309. Description
  310. left(b_desc,20)
  311. b_low
  312. b_high
  313. Customer
  314. b_code
  315.  now open secondary file and define its table
  316. \vb\vxbtest\aircraft.dbf
  317. Error Opening aircraft.dbf. Aborting.
  318. \vb\vxbtest\aircraf2.ntx
  319.  on type
  320. c_cat
  321. c_code
  322. Price
  323. c_price
  324. c_year
  325. c_ttsn
  326.  reselect the master file and set up the join 
  327. b_cat
  328. Possible Sales
  329.  this joins the Aircraft file using the index selected for
  330.  it to the buyer file. The "b_cat" param is the field we
  331.  will use as a key into the aircraft file and the VX_FIELD
  332.  item tells vxBase that it is a field and not an expression.
  333.  The last item in the call is a title for the join window.
  334.  disable menu items that might affect our display-
  335.  now set up and execute the browse. The JOIN menu item is-
  336.  automatically enabled. 
  337. Buyer Details
  338.  when we return from the browse we can ignore anything
  339.  vxBase sent back to us in the BuyerReturn param
  340.  we could get fancy and get the customer record if the
  341.  use hit enter and then display or edit it. Do
  342.  whatever you like.t
  343.  re-enable menu items-
  344. LinkSellToBuy_Click
  345.  Browse the aircraft for sale file and join to
  346.  potential buyers. See a more detailed explanantion of
  347.  visual relationships in the LinkBuyToSell Proct
  348.  open file that will control the join-
  349. \vb\vxbtest\aircraft.dbf
  350. Error Opening aircraft.dbf. Aborting.
  351. \vb\vxbtest\aircraf2.ntx
  352.  on type
  353.  define table to show data we are interested iny
  354. c_cat
  355. Description
  356. left(c_desc,20)
  357. c_code
  358. Price
  359. c_price
  360. c_year
  361. c_ttsn
  362.  now open secondary file and define its table
  363. \vb\vxbtest\airbuyer.dbf
  364. Error Opening airbuyer.dbf. Aborting.
  365. \vb\vxbtest\airbuy2.ntx
  366. b_cat
  367. b_low
  368. b_high
  369. Customer
  370. b_code
  371.  reselect the master file and set up the join
  372. c_cat
  373. Possible Buyers
  374.  this joins the buyer file using the index selected for
  375.  it to the aircraft file. The "c_cat" param is the field we
  376.  will use as a key into the buyer file and the VX_FIELDd
  377.  item tells vxBase that it is a field and not an expression.
  378.  The last item in the call is a title for the join window.
  379.  disable menu items-
  380.  now set up and execute the browse. The JOIN menu item is-
  381.  automatically enabled. 
  382. Aircraft Record Display
  383.  when we return from the browse we can ignore anything
  384.  vxBase sent back to us in the BuyerReturn param
  385.  re-enable menu items-
  386. OpenAircraft_Click
  387.  both routines in VXBMOD.BAS
  388. OpenCust_Click
  389.  open brokerage customers file
  390. \vb\vxbtest\aircust.dbf
  391. Error Opening aircust.dbf. Aborting.
  392. \vb\vxbtest\aircust1.ntx
  393. \vb\vxbtest\aircust2.ntx
  394. \vb\vxbtest\aircust3.ntx
  395.  Declare Customer Tablen
  396. a_code
  397. a_name
  398. a_city
  399. State
  400. a_state
  401. Res Phone
  402. a_phoneres
  403. Bus Phone
  404. a_phonebus
  405.  open state abbreviations file
  406.  in VXBMOD.BAS
  407.  start browse tableS
  408.  in module VXMOD.BAS
  409. OpenTypes_Click
  410.  in VXBMOD.BAS
  411.  start browse tableS
  412.  in module file VXBMOD.BAS
  413. PackFiles_Click
  414.  removes logically deleted records
  415.  and reindexes
  416.  test pack with bitmaps 
  417.  j% = vxUseDbf("\vb\vxbtest\airpics.dbf")
  418.  j% = vxPack(VXFORM1.hWnd)
  419.  j% = vxClose()F
  420.  set meter bar off for this file
  421. \vb\vxbtest\airtypes.dbf
  422. airtypes in use!
  423. \vb\vxbtest\airtypes.dbf
  424. \vb\vxbtest\airtypes.ntx
  425.  set meter bars back on for the rest
  426. \vb\vxbtest\aircust.dbf
  427. aircust in use!
  428. \vb\vxbtest\aircust.dbf
  429. \vb\vxbtest\aircust1.ntx
  430. \vb\vxbtest\aircust2.ntx
  431. \vb\vxbtest\aircust3.ntx
  432. \vb\vxbtest\airbuyer.dbf
  433. airbuyer in use!
  434. \vb\vxbtest\airbuyer.dbf
  435. \vb\vxbtest\airbuy1.ntx
  436. \vb\vxbtest\airbuy2.ntx
  437. \vb\vxbtest\aircraft.dbf
  438. aircraft in use!
  439. \vb\vxbtest\aircraft.dbf
  440. \vb\vxbtest\aircraf1.ntx
  441. \vb\vxbtest\aircraf2.ntx
  442. PicMenu_Click
  443. PrintItem_Click
  444. RecStruc_Click
  445. \vb\vxbtest\airtypes.dbf
  446. Error Opening airtypes.dbf. Aborting.
  447. \vb\vxbtest\airtypes.ntx
  448. Error Opening airtypes.ntx. Aborting.
  449. RelStart_Click
  450. TestCopy_Click
  451.  disable items that would be affected by
  452.  closure of airtypes file 
  453. \vb\vxbtest\airtypes.dbf
  454. \vb\vxbtest\airtypes.ntx
  455. \vb\vxbtest\testcopy.dbf
  456. Error in database copy struc
  457. \vb\vxbtest\testcopy.dbf
  458.  index create opens and selects new index and-
  459.  returns the index select area. Zero (FALSE)
  460.  is returned if there was an error
  461. \vb\vxbtest\testcopy.ntx
  462. Error in index create
  463. \vb\vxbtest\airtypes.dbf
  464. Error in append from
  465. New File
  466. Zap successful
  467. Zap Failed
  468. \vb\vxbtest\testcopy.dbf
  469. \vb\vxbtest\testcopy.ntx
  470. TestCreate_Click
  471.  1234567890123456  (ruler to help alignment)
  472. CATEGORY  C  3 0
  473. CATNAME   C 15 0
  474.  our field length for the second field is shorter-
  475.  than the original file so when we appendfrom below
  476.  this field should be truncated and will show as
  477.  such in the browseb
  478. \vb\vxbtest\typefile.dbf
  479. Error in database creation
  480. \vb\vxbtest\typefile.dbf
  481.  index create opens and selects new index and
  482.  returns the index select area. Zero (FALSE)
  483.  is returned if there was an error
  484. \vb\vxbtest\typefile.ntx
  485. category
  486. Error in index create
  487. \vb\vxbtest\airtypes.dbf
  488. Error in append from
  489. New File
  490. \vb\vxbtest\typefile.dbf
  491. \vb\vxbtest\typefile.ntx
  492. TestDataCopy_Click
  493. \vb\vxbtest\airtypes.dbf
  494. \vb\vxbtest\airtypes.ntx
  495. \vb\vxbtest\testdata.dbf
  496. Error in database copy
  497. \vb\vxbtest\testdata.dbf
  498.  Test delete range
  499. Error in DeleteRange
  500.  index create opens and selects new index and
  501.  returns the index select area. Zero (FALSE)
  502.  is returned if there was an error
  503. \vb\vxbtest\testdata.ntx
  504. Error in index create
  505.  test ntx name function"
  506. \vb\vxbtest\testdata.dbf
  507. \vb\vxbtest\testdata.ntx
  508. TextForm_Click
  509. UMenu_Click
  510.  this proc shows how to set up user defined
  511.  menus on a browse window and also how toe
  512.  define the browse window initial position
  513.  Open aircraft types file-
  514. \vb\vxbtest\airtypes.dbf
  515. Error Opening airtypes.dbf. Aborting.
  516. \vb\vxbtest\airtypes.ntx
  517. Error Opening airtypes.ntx. Aborting.
  518.  Declare types table
  519. category
  520. Description
  521. catname
  522.  Declare and build a user menu
  523.  19 items in the menu
  524.  the menu item params are:
  525.    (1) menu index number (from 1 to whatever was declared)
  526.    (2) attach this item to submenu number where 0 is the
  527.  top level browse menu and any other number must
  528.  refer to a menu index that was defined as VX_MENUHEAD
  529.    (3) the menu string. An ampersand in front of a character
  530.  will make that character the mnemonic. If a VX_SEPBAR
  531.  is being defined, pass a space " "n
  532.    (4) the menu item type as defined in the global module
  533.  where VX_MENUHEAD is a submenu header,h
  534.  VX_SEPBAR   is a separator bar, and
  535.  VX_RETURN   is a returnable itema
  536.  If any item is selected from the browse that is defined
  537.  as VX_RETURN, the RetVal parameter passed to vxBrowse
  538.  will contain the value of the menu index number plus 100
  539.  and negated (e.g., menu item 6 below will return -106).
  540.  The record pointer will be positioned at the record that
  541.  was highlighted when the return was made. If the user
  542.  presses the ENTER key in the browse, the RetVal willr
  543.  contain the record number that was highlighted when ENTER
  544.  was pressed.r
  545.  the first menu item will set up a submenu on theh
  546.  browse table top level menu (Attach to item 0)h
  547. &File
  548.  the item above is attached to the submenu defined as item 1
  549. &Open
  550. &Save
  551.  the item above creates another submenu within the File menu
  552. &New Name
  553.  the items above are under the sub menu defined as item 4)
  554. &Print
  555. E&xit
  556.  now we'll set up another menu on the top level browse menu
  557. &Edit
  558.  and attach items to menu number 11 below it
  559. &Copy
  560. &Paste
  561. Cl&ear
  562. &Delete
  563.  The proc below will set up an initial position 
  564.  for the browse window
  565.  the coordinates are in familiar character and linew
  566.  units. The first param is x (characters in from left),m
  567.  the second param is y (lines down from top), the thirdm
  568.  param is the width of the window in characters, and the
  569.  last param is the window height in linesa
  570.  if the user movers or sizes the window, and subsequente
  571.  vxBrowse calls are made with an intervening close of the
  572.  file, the window will retain its last position and size.
  573.  now we set up the browset
  574. Aircraft Types
  575.  Note that the EDIT menu parameter should be FALSE if you
  576.  are defining your own menus.m
  577. Value returned from browse was 
  578.